<?php $this->load->view('config/header');?>
<h1>Menu</h1>
<ol class="breadcrumb">
  <li><a href="<?php echo site_url()?>home"><i class="icon-dashboard"></i> Dashboard</a></li>
  <li class="active"><i class="icon-edit"></i> Menu</li>
</ol>
<?php $success = $this->session->flashdata('success');?>
<?php if ($success):?>
	<div class="alert alert-success alert-dismissable">
		<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
		Data telah tersimpan
	</div>
<?php endif?>

<?php $error = $this->session->flashdata('error');?>
<?php if ($error):?>
	<div class="alert alert-danger alert-dismissable">
		<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
		Data gagal tersimpan
	</div>
<?php endif?>

<?php $delete = $this->session->flashdata('delete');?>
<?php if ($delete):?>
	<div class="alert alert-success alert-dismissable">
		<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
		Data telah terhapus
	</div>
<?php endif?>
<a href="<?php echo site_url()?>setmenu/add" class="btn btn-primary"> Tambah data </a>
<div id="search" class="col-lg-3">
	<form method="post" class="form-horizontal" action="<?php echo site_url() ?>setmenu/searchData" >
		<div class="form-group input-group">
			<input type="text" class="form-control" name="name" >
			<span class="input-group-btn">
				<button class="btn btn-default" name="submit" type="submit"><i class="icon-search"></i></button>
			</span>
		</div>
	</form>
</div>
<table class="table table-condensed table-hover">
	<thead>
		<th>#</th>
		<th>Nama Menu</th>
		<th>Aktif / Non Aktif</th>
		<th>Aksi</th>
	</thead>
	<tbody>
	<?php if (@$results):?>
		<?php $i=1;?>
		<?php foreach ($results as $row):?>
		<tr>
			<td><?php echo $i;?></td>
			<td><?php echo $row['nama_menu']?></td>
			<td>
				<?php if($row['enable_menu'] == 1):?>
					Aktif
				<?php else:?>
					Non Aktif
				<?php endif;?>
			</td>
			<td>
				<a href="<?php echo site_url()?>setmenu/edit/<?php echo $row['id_menu']?>" class="icon-edit"></a>&nbsp;
				<a href="<?php echo site_url()?>setmenu/delete/<?php echo $row['id_menu']?>" class="icon-trash" onclick="return confirm('Anda yakin akan menghapus data ini?');"></a>
			</td>
		</tr>
		<?php $i++;?>
		<?php endforeach?>
	<?php else:?>
		<tr>
			<td colspan="4">
				<div class="alert alert-info" style="text-align:center">
					Tidak ada record
				</div>
			</td>
		</tr>
	<?php endif?>
	</tbody>
</table>
<?php $this->load->view('config/footer');?>